Skip to content

Fix multi-shift (3-5) save + add regression tests#1474

Merged
renemadsen merged 8 commits intostablefrom
fix/multi-shift-save-and-render
Apr 14, 2026
Merged

Fix multi-shift (3-5) save + add regression tests#1474
renemadsen merged 8 commits intostablefrom
fix/multi-shift-save-and-render

Conversation

@renemadsen
Copy link
Copy Markdown
Member

Summary

  • Backend fix: Update() and UpdateByCurrentUserNam() in TimePlanningPlanningService now copy planned shifts 3-5 from the request model onto the PlanRegistration entity. Before this, shifts 3-5 were silently dropped on every save even though the entity columns exist and the read path sums all 5.
  • C# integration test: PlanningServiceMultiShiftTests round-trips all 5 shifts (00:00-01:00 /5min, 02:00-03:00 /10min, 04:00-05:00 /15min, 06:00-07:00 /20min, 07:00-08:00 /25min) through Update() + EF reload.
  • Playwright E2E: dashboard-edit-multishift.spec.ts exercises the full web UI — fills all 5 shifts in the workday-entity dialog, saves, reopens, and asserts every field round-trips. Guards against regressions on the Angular + C# side together.

Test plan

  • CI integration tests pass (including new PlanningServiceMultiShiftTests)
  • Playwright run covers the new dashboard-edit-multishift.spec.ts
  • Manual smoke on customer 855 gps@microting.com: edit multi-shift day in web UI — shifts 3-5 survive reload

🤖 Generated with Claude Code

renemadsen and others added 8 commits April 13, 2026 16:13
Replace fragile name-matching (site.Name vs FirstName+LastName) with
email-based lookup (worker.Email ↔ Users.Email) across all 3 services.
Read PhoneNumber from SDK Workers table where it's actually stored,
not from Angular Users table where it was always NULL.

Fixes: 8 occurrences in TimeSettingService, TimePlanningWorkingHoursService,
and TimePlanningPlanningService.

Adds integration tests verifying phone numbers flow through
GetAvailableSitesByCurrentUser correctly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The planning save paths only copied shifts 1-2 from the request model
onto the PlanRegistration entity, silently dropping shifts 3-5 even
though the entity columns exist and the read path sums all five.
UpdateByCurrentUserNam (the path reached by the Flutter worker app via
gRPC) was missing the assignments entirely.

Adds a C# integration test that round-trips all 5 shifts through
Update() + EF, and a Playwright E2E that exercises the full web UI
save/reload of all 5 shifts in the workday-entity dialog — both serve
as regression guards.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- PlanningServiceMultiShiftTests: Update() dereferences currentUserAsync.Id;
  stub IUserService.GetCurrentUserAsync to return EformUser { Id = 1 } so the
  persistence assertion exercises the real save path instead of swallowing an
  NRE as "ErrorWhileUpdatingPlanning".
- dashboard-edit-multishift.spec: simplify pickTime to match the existing
  helper pattern and shift all 5 slots away from 00:xx (Material timepicker's
  "12" sits at a non-rotateZ position that broke the click locator).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…s.Auth)

CI build failed with CS0246: EformUser lives in
Microting.eFormApi.BasePn.Infrastructure.Database.Entities, not
...Infrastructure.Models.Auth.

Verified with `dotnet build` locally: 0 errors.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The rotateZ-selector approach breaks for hour=0 (the "12" position doesn't
render with a stable `rotateZ(0deg)` computed style), so every break-time
click (00:05/00:10/…) timed out. Switch to coordinate-based clicks on
`.clock-face`, same strategy as time-planning-settings.spec.ts, which
handles h=0 uniformly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… test

The workday-entity dialog only renders shift rows 3-5 when
thirdShiftActive/fourthShiftActive/fifthShiftActive are true on the
assigned site. CI defaults them to false, so the test timed out
waiting for [data-testid="plannedStartOfShift3"]. Open the
assigned-site dialog via #firstColumn0 first and tick the three
cascading checkboxes, then proceed with the day-cell edit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The assigned-site dialog gates the 4th checkbox on `data.thirdShiftActive`
and the 5th on `data.fourthShiftActive` — both bound to the dialog input
snapshot, not the live form control. So each flag only materialises after
a save + reopen. Loop three times: open dialog, tick the next checkbox,
save, close.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The prelude was ticking thirdShiftActive on row 0 (#firstColumn0) but
the test edits row 3 (#cell3_0), so the workday dialog still opened
with the default 2-shift assigned site and timed out waiting for
plannedStartOfShift3. Align the assigned-site dialog target with the
day-cell target.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@renemadsen renemadsen merged commit 7b018ee into stable Apr 14, 2026
37 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant